#include<bits/stdc++.h>

using namespace std;
long long n,l,r,m,rl;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	m=(l/n)*n+n;
	rl=(l/n)*n;
	if(m<=r)
	{
		cout<<n-1;
	}
	else
	{
		cout<<r-rl;
	}
	return 0;
}
